/** \file Throw_t.cc 
 * Test definitions for the class Throw.
 *
 * (c) Copyright  Semih Cemiloglu
 * All rights reserved, see COPYRIGHT file for details.
 *
 * $Id: Throw_t.cc 119 2006-06-21 04:57:25Z semihc $
 *
 *
 */

#include "Throw_t.hh"
#include <QtTest/QtTest>
#include "Throw.hh"
#include "Ex.hh"
#include "ExString.hh"
#include "Debug.hh"

using namespace std;
using namespace TC;


void Throw_t::tests()
{
  const char* IgnoreStr = "Ignore following exception:";
  
  try {
    Throw("Throwing Ex",0);
    QVERIFY(false);
  }
  catch(const Ex& e) {
    TC_LOG_INFO(IgnoreStr);
    TC_LOG_EX(e);
  }


  try {
    Throw("Throwing ExSimple",0,__FILE__,__LINE__,TC_FUNCTION);
    QVERIFY(false);
  }
  catch(const ExSimple& e) {
    TC_LOG_INFO(IgnoreStr);
    TC_LOG_EX(e);
  }


  try {
    TC_THROW("Throwing exception with context (const char*)");
    QVERIFY(false);
  }
  catch(const ExSimple& e) {
    TC_LOG_INFO(IgnoreStr);
    TC_LOG_EX(e);
  }

  try {
    string s = "Throwing exception with context (string)"; 
    TC_THROW(s);
    QVERIFY(false);
  }
  catch(const ExString& e) {
    TC_LOG_INFO(IgnoreStr);
    TC_LOG_EX(e);
  }

    
  QVERIFY(true);
}




